package com.itheima.test;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itheima.domain.db.User;
import com.itheima.domain.db.UserInfo;
import com.itheima.mapper.UserMapper;
import com.itheima.service.db.UserInfoService;
import com.itheima.service.db.UserServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
public class Demo {

    @Autowired
    UserServiceImpl userService;

    @Autowired
    UserMapper userMapper;

    @Autowired
    UserInfoService userInfoService;

    @Test
    public void test(){
        User byPhone = userService.findByPhone("13800138000");
        System.out.println(byPhone);
    }
    @Test
    public void test1(){
        // User byPhone = userService.findByPhone("13800138000");
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("mobile","13800138000");

        User user = userMapper.selectOne(wrapper);


        System.out.println(user);
    }

    @Test
    public void test2(){
        UserInfo byUserId = userInfoService.findByUserId(117L);
        System.out.println(byUserId);
    }

}
